package com.supply.supplymanage.biz;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.supply.supplymanage.dao.FrpruMapper;
import com.supply.supplymanage.entity.Frpru;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service

public class FrpruBizImpl implements FrpruBiz{
    @Resource
    private FrpruMapper frpruMapper;
    @Override
    //分页查询已审核
    public PageInfo queryfrpru(Integer pageNum) {
        PageHelper.startPage(pageNum,5);
        List<Map> maps=frpruMapper.queryfrpru();
        PageInfo<Map> pageInfo = new PageInfo<Map>(maps);
        return pageInfo;
    }  //分页查询未审核
    public PageInfo queryfrpru2(Integer pageNum) {
        PageHelper.startPage(pageNum,5);
        List<Map> maps=frpruMapper.queryfrpru2();
        PageInfo<Map> pageInfo = new PageInfo<Map>(maps);
        return pageInfo;
    }
    //供应商查询
    public PageInfo supnameAll(Integer PageNum,String supname) {
        PageHelper.startPage(PageNum,5);
        List<Map> maps = frpruMapper.supnameAll(supname);

        PageInfo<Map> pageInfo = new PageInfo<Map>(maps);
        return pageInfo;
    }
    //仓库查询
    public PageInfo entrynameAll(Integer PageNum,String entryname) {
        PageHelper.startPage(PageNum,5);
        List<Map> maps = frpruMapper.entrynameAll(entryname);
        PageInfo<Map> pageInfo = new PageInfo<Map>(maps);
        return pageInfo;
    }

    @Override
    //添加
    public void addfrpru(Frpru frpru) {
        frpruMapper.addfrpru(frpru);
    }
    //删除
    @Override
    public int delfrpru(int frpid) {
        frpruMapper.delfrpru(frpid);
        return 0;
    }
//查询一条数据
    @Override
    public List<Map> queryfrpruOne(Integer frpid) {
        List<Map> maps = frpruMapper.queryfrpruOne(frpid);
        return maps;
    }

    //修改未审核状态
    @Override
    public void checked1(Integer frpid) {
        System.out.println(frpid);
        frpruMapper.checked1(frpid);
    }
    //修改已审核状态
    @Override
    public void updateaudit(Integer frpid) {
        System.out.println(frpid);
        frpruMapper.updateaudit(frpid);
    }
    //查询仓库
    @Override
    public List<Map> queryfrpruentrepot() {
        return frpruMapper.queryfrpruentrepot();
    }
    //查询供货商
    @Override
    public List<Map> queryfrprusupplier() {
        return frpruMapper.queryfrprusupplier();
    }
    //查询进货人
    @Override
    public List<Map> queryfrpruclient() {
        return frpruMapper.queryfrpruclient();
    }


}
